/************************************************************************************
* YampManager.h                                                                     *
*                                                                                   *
* Copyright (C) 2011 Varuna L Amachi                                                *
*                                                                                   *
* This program is free software; you can redistribute it and/or modify              *
* it under the terms of the GNU General Public License as published by              *
* the Free Software Foundation; either version 2 of the License, or any             *
* later version.                                                                    *
*                                                                                   *
* This program is distributed in the hope that it will be useful, but               *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY        *
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for       *
* more details. You should have received a copy of the GNU General Public           *
* License along with this program; if not, write to the Free Software Foundation,   *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                       *
*                                                                                   *
*************************************************************************************/

#ifndef YAMPMANAGER_H
#define YAMPMANAGER_H

#include "common/YampComponent.h"
#include "YListWidget.h"
#include "interfaces/IComponentManager.h"
#include "widgets/OrientationButton.h"

#include <QWidget>
#include <QHash>
#include <QSplitter>
#include <QString>
#include <QStackedWidget>
#include <QComboBox>
#include <QListWidgetItem>


class YampManager : public QWidget, public Yamp::IComponentManager
{
    Q_OBJECT

    QHash<QString, YampComponent*>* m_components;
    //This is not very good:(
    QHash<QString, int>* m_nameIndexMap;
    QStackedWidget* m_wstack;
    QListWidget *m_listWidget;
    OrientationButton *m_toggleViz;
    bool m_showList;
    void setupUi();
    void setupActions();
    void setupConnections();

public:
    explicit YampManager(QWidget *parent = 0);
    virtual ~YampManager();

signals:
    void componentSelected(YampComponent* comp);

public slots:
    QList<YampComponent*> getAllComponents();
    void addComponent(YampComponent *comp);
    void removeComponent(QString componentName);
    YampComponent* component(QString name);
    void indexSelected(QModelIndex index);
    void setListVisibility();
};

#endif // YAMPMANAGER_H
